// personal.js
Page({
  data: {
    userInfo: {
      name: '张三',
      avatarUrl: '/images/avatar.png'
    },
    reservedActivities: []
  },

  onLoad: function() {
    // 从mock数据中获取已预约活动
    const activities = require('../../mock/activities.js');
    // 模拟已预约的活动（这里随机选择2个活动作为示例）
    const reservedActivities = activities.sort(() => 0.5 - Math.random()).slice(0, 2);
    this.setData({
      reservedActivities
    });
  },

  // 跳转到活动详情页
  goToActivityDetail: function(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/detail/detail?id=${id}`
    });
  }
})